package com.cloud.service.impl;


import com.cloud.dao.UserDao;
import com.cloud.data.UserDataManager;
import com.cloud.dto.UserDto;
import com.cloud.model.User;
import com.cloud.service.UserService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService{

	protected static Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);
	
	@Autowired
	private UserDao userMapper;

	@Autowired
	private UserDataManager userDataManager;

//	@Cacheable(value ="userCache")
	@Override
	public UserDto searchAll(){
//		UserDto user = userDataManager.getUserData(RedisContents.REDIS_DATA_USER);
		UserDto user= null;
		if(user == null){
			user = new UserDto();
			List<User> list = userMapper.findAll();
			LOGGER.info("user list："+list);
			user.setUserList(list);
//			userDataManager.setUserData(RedisContents.REDIS_DATA_USER,user);
		}

		return user;
	}
}
